import Vue from "vue";
import Vuex from "vuex";
import state from "./state";
import mutations from "./mutations";
import actions from "./actions";
import getters from "./getters"
// vuex data persisted plugins
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex);

export default new Vuex.Store({
    state,
    mutations,
    actions,
    getters,
    plugins: [createPersistedState({
        reducer(val) {
            return {
                // store in state the token
                token: val.token,
                roles: val.roles,
                tagsList: val.tagsList,
                lang: val.lang,
                breadList: val.breadList
            }
        }
    })]
});
